<?php

namespace app\system\controller;

class File extends Base
{

    public function upload(){
//        exit("q");
        // 获取表单上传文件 例如上传了001.jpg
        $file = request()->file('file');
        // 上传到本地服务器
        $savename = \think\facade\Filesystem::putFile( 'topic', $file);

        $path = '/storage/'. $savename;
        $returnData = [
            'code'=> 200,
            'msg'=> '操作成功',
            'url'=> $path
        ];
        return json($returnData);
    }
}